package com.nstar.uecenter.view.main.impl
{
	import com.nstar.base.event.AdvanceEvent;
	import com.nstar.base.util.Logger;
	import com.nstar.uecenter.view.main.Footer;
	import com.nstar.uecenter.view.main.Header;
	import com.nstar.uecenter.view.main.UECenterMain;
	
	import flash.events.Event;
	
	import mx.containers.VBox;
	import mx.events.FlexEvent;
	import mx.events.ItemClickEvent;

	public class MainScreenClass extends VBox
	{
		public var header:Header;
		public var uecMain:UECenterMain;
		public var footer:Footer;
		
		public static const CREATION_COMPLETE: String = "myCreationComplete";
		
		public var logger:Logger = Logger.getInstance(this);
		
		public function MainScreenClass()
		{
			//TODO: implement function
			super();
			this.dispatchEvent( new Event( CREATION_COMPLETE ) );
			this.addEventListener(FlexEvent.CREATION_COMPLETE,init);
		}
		
		private function init(event:FlexEvent):void{
			header.addEventListener(ItemClickEvent.ITEM_CLICK,navigatorHandler);
			uecMain.addEventListener(AboutUsClass.USER_EXPERIENCE_CENTER,aboutUsHandler);
			uecMain.addEventListener(AboutUsClass.LABS,aboutUsHandler);
			uecMain.addEventListener(AboutUsClass.CONTACT_US,aboutUsHandler);
		}
		
		private function navigatorHandler(event:ItemClickEvent):void{
			uecMain.vsUECenter.selectedIndex = event.index;
		}	
		
		private function aboutUsHandler(event:AdvanceEvent):void{
			header.tbbMain.selectedIndex = int(event.request);
		}
	
	}
}